import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutterapp/src/page/play/video_detail2_widget.dart';

class ListItem2Widget extends StatefulWidget {
  final bool isScroll;
  final StreamController streamController;
  ListItem2Widget({this.streamController, this.isScroll = false});
  @override
  _ListItem2WidgetState createState() => _ListItem2WidgetState();
}

class _ListItem2WidgetState extends State<ListItem2Widget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: 2),
      padding: EdgeInsets.all(10),
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // 视频层
          Container(
            height: 220,
            child: buildVideoWidget(),
          )
        ],
      ),
    );
  }

  Widget buildVideoWidget() {
    if (widget.isScroll) {
      return Container(
        width: MediaQuery.of(context).size.width,
        child: Image.asset(
          "assets/images/welcome.png",
          fit: BoxFit.fitWidth,
        ),
      );
    }
    return VideoDetail2Widget(
      streamController: widget.streamController,
    );
  }
}
